var opinionPrice;

/**
 * 设置结果接收对象
 * @param _opinionPrice
 */
function setModel(_opinionPrice) {
    if (_opinionPrice == undefined || !(_opinionPrice instanceof com.jf.crawl.model.OpinionPrice)) {
        throw new java.lang.Exception("opinionPrice 对象为空");
    }
    log.info("opinionPrice {}", _opinionPrice)
    opinionPrice = _opinionPrice;
}

function crawler() {
    //人人贷
    //  1个月--6.0
    //  3个月--6.6
    //  6个月--7.2
    //  12个月--8.8
    //  24个月--9.8
    var html = Get("https://www.renrendai.com/pc/uPlan.html");
    var document = Jsoup.parse(html);
    var items = document.select(".uplan-list li");
    for (var i = 0; i < items.size(); i++) {
        var item = items.get(i);
        var month = item.select(".month").text();
        var price = item.select(".num > .fu").text()
        if ("1个月".equals(month)) {
            opinionPrice.setOneMonth(commonUtil.string2Decimal(price));
        } else if ("3个月".equals(month)) {
            opinionPrice.setThreeMonth(commonUtil.string2Decimal(price));
        } else if ("6个月".equals(month)) {
            opinionPrice.setSixMonth(commonUtil.string2Decimal(price));
        } else if ("12个月".equals(month)) {
            opinionPrice.setOneYear(commonUtil.string2Decimal(price));
        } else if ("24个月".equals(month)) {
            opinionPrice.setTwoYear(commonUtil.string2Decimal(price));
        } else if ("36个月".equals(month)) {
            opinionPrice.setThreeYear(commonUtil.string2Decimal(price));
        }
    }
    return true;
}